﻿@using BonjourQuotation.UI.Models.SetupModel
@model SetupCardsGridViewModel

@using (@Html.BeginForm("SaveCardDetailData", "Setup", FormMethod.Post, new { id = "LoadCardDetailsForm"}))
{
    <div id="ErrorMessagesDivPopUp" style="margin:auto;width:960px; height: 30px; ">
        <label for="Validation" id="errorMessageClient" class="errorMessage"></label>
        @if (Model.Message != null)
        {
            @Html.LabelForModel(Model.Message, new { @class = "errorMessage", id = "errorMessageServer" })
        }
    </div>

    <div style="width: 881px; min-height: 300px; max-height: 442px; margin: auto; padding-bottom: 30px; ">
        <table class="table table-bordered table-hover table-condensed" style="margin-bottom: -1px !important; width: 860px;background-color:white;">
            <thead>
                <tr>
                    <th width="15%;" class="GridHeaders">Credit Card Type</th>
                    <th width="25%;" class="GridHeaders">Credit Card Number</th>
                    <th width="30%;" class="GridHeaders">Card Holder Name</th>
                    <th width="10%;" class="GridHeaders">Exp. Date:</th>
                    <th width="10%;" class="GridHeaders">Active</th>
                    <th width="10%;" class="GridHeaders">Delete</th>
                </tr>
            </thead>
        </table>
        <div style="height:350px; overflow-y:auto;">
            <table class="table table-bordered table-hover table-condensed" style="width: 860px; table-layout: fixed; background-color: white;">
                <tbody>
                    @for (int ind = 0; ind < Model.Rows.Count; ind++)
                    {
                        Model.SelectedCardTypeID = Model.Rows[ind].CardTypeID;
                        @Html.HiddenFor(model => model.Rows[ind].CardID);
                        if(Model.MenuSetupCreditCardEdit)
                        { 
                            <tr>
                                <td width="15%;" style="text-align:left">
                                    @Html.DropDownListFor(model => Model.SelectedCardTypeID, new SelectList(Model.CardType, "Value", "Text"), new { @class = "table_inputs_120 table_inputs_WithoutBox ChangedCardElements CardTypeDrop ForValidation Required", @style = "text-align: left" })
                                    @Html.DropDownListFor(model => Model.Rows[ind].CardTypeID, new SelectList(Model.CardType, "Value", "Text"), new { @class = "RoomGridDropHide" })
                                </td>
                                <td width="25%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].CardNumber, new { @class = "table_inputs_205 table_inputs_WithoutBox ChangedCardElements ForValidation Required CreditCard", @style = "text-align: left" })</td>
                                <td width="30%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].PlaceHolderName, new { @class = "table_inputs_250 table_inputs_WithoutBox ChangedCardElements ForValidation SetupCreditCardMaxLength100 Required", @style = "text-align: left" })</td>
                                <td width="10%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].CardValidToDate, new { @class = "table_inputs_76 table_inputs_WithoutBox ChangedCardElements CardDeteilsDataCalendar ForValidation Date Required", @style = "cursor:pointer;text-align: left" })</td>
                                @*<td width="10%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].CardValidFromDate, new { @class = "form-control table_inputs_WithoutBox ChangedCardElements CardDeteilsDataCalendar ForValidation Date Required", @style = "cursor:pointer;text-align: left" })</td>*@
                                <td width="10%;" style="text-align:center">@Html.CheckBoxFor(model => model.Rows[ind].IsActive, new { @class = "ChangedCardElements" })</td>
                                <td width="10%;" style="text-align:center"><button class="btn14 btn-danger btn60 btnheight22" type="button" onclick="DeleteCard(@Model.Rows[ind].CardID)">Delete</button></td>
                            </tr>
                        }
                        else
                        {
                            <tr>
                                <td width="15%;" style="overflow: hidden">
                                    @Html.DropDownListFor(model => Model.SelectedCardTypeID, new SelectList(Model.CardType, "Value", "Text"), new { @class = "table_inputs_140 table_inputs_WithoutBox DisabledDropDown", @disabled = "disabled", @style = "font-weight:bold" })
                                    @Html.DropDownListFor(model => Model.Rows[ind].CardTypeID, new SelectList(Model.CardType, "Value", "Text"), new { @class = "RoomGridDropHide" })
                                </td>
                                <td width="25%;" style="overflow-x: hidden">@Html.LabelForModel(Model.Rows[ind].CardNumber, new { @class = "table_inputs_215", @style = "text-align: left" })</td>
                                <td width="30%;" style="overflow-x: hidden">@Html.LabelForModel(Model.Rows[ind].PlaceHolderName, new { @class = "table_inputs_258", @style = "text-align: left" })</td>
                                <td width="10%;" style="overflow-x: hidden">@Html.LabelForModel(Model.Rows[ind].CardValidToDate, new { @class = "table_inputs_85", @style = "text-align: left" })</td>
                                @*<td width="10%;" style="text-align:left">@Html.TextBoxFor(model => model.Rows[ind].CardValidFromDate, new { @class = "form-control table_inputs_WithoutBox ChangedCardElements CardDeteilsDataCalendar ForValidation Date Required", @style = "cursor:pointer;text-align: left" })</td>*@
                                <td width="10%;" style="overflow-x: hidden">@Html.LabelForModel(Model.Rows[ind].IsActive ? "Yes" : "No", new { @class = "table_inputs_85" })</td>
                                <td width="10%;" style="overflow-x: hidden"><button class="btn14 btn-danger btn60 btnheight22" type="button" disabled="disabled" onclick="DeleteCard(@Model.Rows[ind].CardID)">Delete</button></td>
                            </tr>
                        }
                    }
                </tbody>
            </table>
        </div>
    </div>
}
<div style="float: right; height: 25px; width: 140px; margin-right: 95px; ">
    <button class="btn14 btn60" style="float: left;@(@Model.IsCanView ? "" : "Display:none ")" type="button" id="CardMoreBtn">More</button>
    @if(Model.MenuSetupCreditCardEdit)
    { 
        <button class="btn14 btn50" style="float: right;" type="button" id="CardDetailsSaveBtn">Save</button>
    }
    else
    { 
        <button class="btn14 btn50" style="float: right;" type="button" disabled="disabled" id="CardDetailsSaveBtn">Save</button>
    }
</div>
